﻿#ifndef __SS_COPY_H__
#define __SS_COPY_H__
#include <memory.h>

namespace StarSeeker
{

	//判断长度的内存拷贝
	template<class T1, class T2>
	inline bool SafeCopy(T1* to, T2* from)
	{
		if (sizeof(T2) <= sizeof(T1))
		{
			::memcpy(to, from, sizeof(T2));
			return true;
		}
		return false;
	}

	template<class T1, class T2>
	inline bool SafeCover(T1* to, T2* from)
	{
		if (sizeof(T2) <= sizeof(T1))
		{
			::memmove(to, from, sizeof(T2));
			return true;
		}
		return false;
	}

}

#endif
